# 主页
import time

from selenium.webdriver.common.by import By

from wxin_po.package.basedriver import BaseDriver
from wxin_po.package.contact_page import ContactPage


class IndexPage(BaseDriver):
    # 通过点击通讯录进入通讯录界面
    def click_contact(self):
        """
        点击通讯录
        :return: 跳转到通讯录页面
        """
        self.find_and_click(By.XPATH, "//*[text()='通讯录']")
        return ContactPage(self._driver)

    # 通过首页的添加成员按钮跳转到编辑成员信息界面
    def click_add_member(self):
        from wxin_po.package.edit_member import EditMember
        # 定位添加成员按钮
        self.find_and_click(By.CSS_SELECTOR, ".ww_indexImg.ww_indexImg_AddMember")
        # 跳转到添加成员信息界面
        return EditMember(self._driver)

